  import { Component } from '@angular/core';
  /*定义一个如下类型的类Heroo*/
  export class Heroo{
   id: number;
   name: string;
   }
  /*HEROES数组，变量为heroo类型*/
  const HEROES: Heroo[] = [
    {id: 11,name:'杨静'},
    {id: 12,name:'任冬雪'},
    {id: 13,name:'李惠'},
    {id: 14,name:'杜玉静'},
    {id: 15,name:'王茹'},
    {id: 16,name:'李阳杰'},
    {id: 17,name:'牛微微'},
    {id: 18,name:'张梦瑶'},
    {id: 19,name:'王如辉'},
    {id: 20,name:'王甜'},
  ];
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  title = 'app works!';
  /*hero: Hero = {
    id: 1,
    name: 'yangjingjing'
  };*/
  //把HEROES赋给heroes
  heroes = HEROES;
  //定义selectHero为Heroo类型的
  selectHero: Heroo;
  onSelect(hero: Heroo): void {
    this.selectHero = hero;
  }
}

